package com.kantboot.api.phone.domain.entity;

import com.kantboot.util.core.jpa.KantbootGenerationType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;
import java.util.Date;

@Table(name = "api_phone_sms")
@Entity
@Getter
@Setter
@Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
public class ApiPhoneSms implements Serializable {

    /**
     * 发送状态编码
     * 发送中
     */
    public static final String STATUS_CODE_SENDING = "sending";

    /**
     * 发送状态编码
     * 发送成功
     */
    public static final String STATUS_CODE_SUCCESS = "success";

    /**
     * 发送状态编码
     * 发送失败
     */
    public static final String STATUS_CODE_FAIL = "fail";

    /**
     * 类型编码(通知类)
     */
    public static final String TYPE_CODE_NOTIFICATION = "notification";

    /**
     * 类型编码(验证码类)
     */
    public static final String TYPE_CODE_VERIFICATION = "verification";

    /**
     * 类型编码(营销推广类)
     */
    public static final String TYPE_CODE_MARKETING = "marketing";

    /**
     * 类型编码(语音类)
     */
    public static final String TYPE_CODE_VOICE = "voice";

    /**
     * 类型编码(物流类)
     */
    public static final String TYPE_CODE_LOGISTICS = "logistics";

    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "snowflakeId",strategy = KantbootGenerationType.SNOWFLAKE)
    @GeneratedValue(generator = "snowflakeId")
    @Column(name = "id")
    private Long id;

    /**
     * 类型编码
     * notification(通知类)、verification(验证码类)、marketing(营销推广类)、voice(语音类)、logistics(物流类)
     */
    @Column(name = "type_code")
    private String typeCode;

    /**
     * 接受者的号码
     */
    @Column(name = "t_to")
    private String to;

    /**
     * 内容
     */
    @Column(name = "t_content", columnDefinition="TEXT")
    private String content;

    /**
     * 发送状态编码
     */
    @Column(name = "status_code")
    private String statusCode;

    /**
     * 发送失败原因编码
     */
    @Column(name = "fail_reason_code")
    private String failReasonCode;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "gmt_modified")
    private Date gmtModified;


}
